package com.mofang.powerdekorhelper.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.Toast;

import com.bumptech.glide.Glide;
import com.mofang.powerdekorhelper.R;

import cn.bingoogolapple.bgabanner.BGABanner;

/**
 * Created by luofei on 2017/8/19 0019.
 */

public class BGABannerAdapter implements BGABanner.Adapter<ImageView, String>, BGABanner.Delegate<ImageView, String>{

    private Context mContext;

    public BGABannerAdapter(Context mContext) {
        this.mContext = mContext;
    }



    @Override
    public void fillBannerItem(BGABanner banner, ImageView itemView, String model, int position) {
        Glide.with(mContext)
                .load(model)
                .placeholder(R.mipmap.ic_launcher)
                .error(R.mipmap.ic_launcher)
                .dontAnimate()
                .centerCrop()
                .into(itemView);
    }

    @Override
    public void onBannerItemClick(BGABanner banner, ImageView itemView, String model, int position) {
        Toast.makeText(mContext, "点击了第" + (position + 1) + "页", Toast.LENGTH_SHORT).show();
    }
}
